﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/eStore.Master" Inherits="System.Web.Mvc.ViewPage<eStore.ViewModels.CartIndexViewModel>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	<%:Model.PageTitle %>
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="HeadContent" runat="server">

</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <h2><%: Model.PageTitle %></h2>
    <div>
        <div>
            <%= Html.ActionLink(" ", "Index", "CheckOut", null, new { @class = "checkoutBtn" })%>
        </div>
        <table>
        <tbody>
        <tr>
            <th>
                Product Name
            </th>
            <th>
                Price(each)
            </th>
            <th>
                Quantity
            </th>
            <th>
                Total 
            </th>
            <th>
            &nbsp;
            </th>
        </tr>
        
        <%  
            decimal dblTotalAmount = 0;
            foreach (var cartItem in Model.CartItems)
            {
                Html.RenderPartial("YourCartItem",cartItem);    
                dblTotalAmount += cartItem.CartItemQty *cartItem.Product.ProductUnitPrice;
            }  
            
         %>
         
         <tr>
            <td>Total</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td id="cart-total">
                RM <%:dblTotalAmount%>
            </td>
        </tr>
         </tbody>
         </table>
    </div>
</asp:Content>

